
<!DOCTYPE HTML>
<html lang="" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>统计 · GitBook</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        
        
        
    
    <link rel="stylesheet" href="../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-search/search.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    
        
    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">

    
    
    <link rel="prev" href="pay.html" />
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="Type to search" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    

    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="../">
            
                <a href="../">
            
                    
                    简介
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2" >
            
                <span>
            
                    
                    入门
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.1" data-path="../introduction/environment.html">
            
                <a href="../introduction/environment.html">
            
                    
                    环境搭建
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.2" data-path="../introduction/hello.html">
            
                <a href="../introduction/hello.html">
            
                    
                    HelloWorld
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.3" data-path="../introduction/dev-and-debug.html">
            
                <a href="../introduction/dev-and-debug.html">
            
                    
                    开发与调试
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.3" >
            
                <span>
            
                    
                    参考
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.1" data-path="../framework/file.html">
            
                <a href="../framework/file.html">
            
                    
                    文件组织
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.2" data-path="../framework/manifest.html">
            
                <a href="../framework/manifest.html">
            
                    
                    manifest文件
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.3" data-path="../framework/nml.html">
            
                <a href="../framework/nml.html">
            
                    
                    nml文件
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.4" data-path="../framework/page.html">
            
                <a href="../framework/page.html">
            
                    
                    页面与组件
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4" >
            
                <span>
            
                    
                    组件
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.1" data-path="../component/general.html">
            
                <a href="../component/general.html">
            
                    
                    通用
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.2" data-path="../component/container.html">
            
                <a href="../component/container.html">
            
                    
                    容器组件
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.3" data-path="../component/basics.html">
            
                <a href="../component/basics.html">
            
                    
                    基础组件
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.4" data-path="../component/form.html">
            
                <a href="../component/form.html">
            
                    
                    表单组件
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.5" data-path="../component/media.html">
            
                <a href="../component/media.html">
            
                    
                    媒体组件
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.5" >
            
                <span>
            
                    
                    接口
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.5.1" data-path="general.html">
            
                <a href="general.html">
            
                    
                    通用规则
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.2" data-path="basic.html">
            
                <a href="basic.html">
            
                    
                    基本功能
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.3" data-path="interface.html">
            
                <a href="interface.html">
            
                    
                    界面交互
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.4" data-path="request.html">
            
                <a href="request.html">
            
                    
                    网络访问
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.5" data-path="storage.html">
            
                <a href="storage.html">
            
                    
                    文件数据
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.6" data-path="system.html">
            
                <a href="system.html">
            
                    
                    系统能力
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.7" data-path="media.html">
            
                <a href="media.html">
            
                    
                    图形图像
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.8" data-path="share.html">
            
                <a href="share.html">
            
                    
                    分享
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.9" data-path="pay.html">
            
                <a href="pay.html">
            
                    
                    支付
            
                </a>
            

            
        </li>
    
        <li class="chapter active" data-level="1.5.10" data-path="stat.html">
            
                <a href="stat.html">
            
                    
                    统计
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            Published with GitBook
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href=".." >统计</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <h3 id="&#x7EDF;&#x8BA1;">&#x7EDF;&#x8BA1;</h3>
<h4 id="&#x63A5;&#x53E3;&#x58F0;&#x660E;">&#x63A5;&#x53E3;&#x58F0;&#x660E;</h4>
<p>{&quot;name&quot;: &quot; service.stat&quot;}</p>
<h4 id="unistatgetproviderobject">uni.stat.getProvider(OBJECT)</h4>
<p>&#x83B7;&#x53D6;&#x670D;&#x52A1;&#x63D0;&#x4F9B;&#x5546;&#xFF0C;&#x5982;&#x5382;&#x5546;&#x7684;&#x82F1;&#x6587;&#x54C1;&#x724C;&#x540D;&#x79F0;&#xFF0C;&#x5047;&#x5982;&#x65E0;&#x6B64;&#x670D;&#x52A1;&#x5219;&#x8FD4;&#x56DE;&#x7A7A;&#x5B57;&#x7B26;&#x4E32;&#x3002;</p>
<p>&#x53C2;&#x6570;</p>
<p>&#x65E0;&#x3002;</p>
<p>&#x8FD4;&#x56DE;&#x503C;</p>
<p>&#x5B57;&#x7B26;&#x4E32;&#xFF0C;&#x670D;&#x52A1;&#x63D0;&#x4F9B;&#x5546;&#x7684;&#x4EE3;&#x53F7;&#x3002;</p>
<p>&#x793A;&#x4F8B;</p>
<pre><code class="lang-javascript">uni.stat.getProvider();
</code></pre>
<h4 id="unistatrecordcounteventobject">uni.stat.recordCountEvent(OBJECT)</h4>
<p>&#x8BA1;&#x6570;&#x7C7B;&#x578B;&#x4E8B;&#x4EF6;&#x3002;&#x901A;&#x5E38;&#x2F64;&#x6765;&#x63CF;&#x8FF0;&#x2F00;&#x4E2A;&#x4E8B;&#x4EF6;&#x7D2F;&#x79EF;&#x53D1;&#x2F63;&#x7684;&#x6B21;&#x6570;&#xFF0C;&#x9002;&#x2F64;&#x7684;&#x573A;&#x666F;&#x5982;&#x6309;&#x94AE;&#x70B9;&#x51FB;&#x3001;&#x754C;&#x2FAF;&#x8FDB;&#x2F0A;&#x3001;&#x2F64;&#x2F3E;&#x8F93;&#x2F0A;&#x7B49;&#x3002;</p>
<p>&#x53C2;&#x6570;</p>
<table>
<thead>
<tr>
<th style="text-align:left">&#x53C2;&#x6570;&#x540D;</th>
<th style="text-align:left">&#x7C7B;&#x578B;</th>
<th style="text-align:left">&#x5FC5;&#x586B;</th>
<th style="text-align:left">&#x8BF4;&#x660E;</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left">category</td>
<td style="text-align:left">String</td>
<td style="text-align:left">&#x5426;</td>
<td style="text-align:left">&#x5B9A;&#x4E49;&#x4E8B;&#x4EF6;&#x7684;&#x7C7B;&#x522B;.&#x5F00;&#x53D1;&#x8005;&#x53EF;&#x4F7F;&#x2F64;&#x8BE5;&#x53C2;&#x6570;&#x5BF9;&#x2F83;&#x5B9A;&#x4E49;&#x6253;&#x70B9;&#x505A;&#x6574;&#x7406;&#x5F52;&#x7C7B;</td>
</tr>
<tr>
<td style="text-align:left">key</td>
<td style="text-align:left">String</td>
<td style="text-align:left">&#x662F;</td>
<td style="text-align:left">&#x5B9A;&#x4E49;&#x4E8B;&#x4EF6;&#x7684;&#x4E3B;&#x952E;&#xFF0C;&#x4F5C;&#x4E3A;&#x8BE5;&#x4E8B;&#x4EF6;&#x7684;&#x552F;&#x2F00;&#x6807;&#x8BC6;</td>
</tr>
<tr>
<td style="text-align:left">map</td>
<td style="text-align:left">Object</td>
<td style="text-align:left">&#x5426;</td>
<td style="text-align:left">&#x5B9A;&#x4E49;&#x4E8B;&#x4EF6;&#x7684;&#x5C5E;&#x6027;&#x548C;&#x53D6;&#x503C;&#xFF08;Key-Value&#x952E;&#x503C;&#x5BF9;&#xFF09;</td>
</tr>
</tbody>
</table>
<p>&#x793A;&#x4F8B;</p>
<pre><code class="lang-javascript">uni.stat.recordCountEvent({
  category: <span class="hljs-string">&quot;Button_Click&quot;</span>,
  key: <span class="hljs-string">&quot;Button_OK_click&quot;</span>
});
</code></pre>
<h4 id="unistatrecordcalculateeventobject">uni.stat.recordCalculateEvent(OBJECT)</h4>
<p>&#x8BA1;&#x7B97;&#x7C7B;&#x578B;&#x4E8B;&#x4EF6;&#x3002;&#x901A;&#x5E38;&#x2F64;&#x6765;&#x63CF;&#x8FF0;&#x2F00;&#x4E2A;&#x5E26;&#x6570;&#x503C;&#x7684;&#x4E8B;&#x4EF6;&#x7684;&#x53D1;&#x2F63;&#xFF0C;&#x9002;&#x2F64;&#x7684;&#x573A;&#x666F;&#x5982;&#x2F64;&#x2F3E;&#x6D88;&#x8D39;&#x4E8B;&#x4EF6;&#xFF0C;&#x9644;&#x5E26;&#x7684;&#x6570;&#x503C;&#x662F;&#x6BCF;&#x6B21;&#x6D88;&#x8D39;&#x7684;&#x2FA6;&#x989D;&#xFF1B;&#x4E0B;&#x8F7D;&#x2F42;&#x4EF6;&#x4E8B;&#x4EF6;&#xFF0C;&#x9644;&#x5E26;&#x7684;&#x6570;&#x503C;&#x662F;&#x6BCF;&#x6B21;&#x4E0B;&#x8F7D;&#x6D88;&#x8017;&#x7684;&#x65F6;&#x95F4;&#x7B49;&#x3002;</p>
<p>&#x53C2;&#x6570;</p>
<table>
<thead>
<tr>
<th style="text-align:left">&#x53C2;&#x6570;&#x540D;</th>
<th style="text-align:left">&#x7C7B;&#x578B;</th>
<th style="text-align:left">&#x5FC5;&#x586B;</th>
<th style="text-align:left">&#x8BF4;&#x660E;</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left">category</td>
<td style="text-align:left">String</td>
<td style="text-align:left">&#x5426;</td>
<td style="text-align:left">&#x5B9A;&#x4E49;&#x4E8B;&#x4EF6;&#x7684;&#x7C7B;&#x522B;.&#x5F00;&#x53D1;&#x8005;&#x53EF;&#x4F7F;&#x2F64;&#x8BE5;&#x53C2;&#x6570;&#x5BF9;&#x2F83;&#x5B9A;&#x4E49;&#x6253;&#x70B9;&#x505A;&#x6574;&#x7406;&#x5F52;&#x7C7B;</td>
</tr>
<tr>
<td style="text-align:left">key</td>
<td style="text-align:left">String</td>
<td style="text-align:left">&#x662F;</td>
<td style="text-align:left">&#x5B9A;&#x4E49;&#x4E8B;&#x4EF6;&#x7684;&#x4E3B;&#x952E;&#xFF0C;&#x4F5C;&#x4E3A;&#x8BE5;&#x4E8B;&#x4EF6;&#x7684;&#x552F;&#x2F00;&#x6807;&#x8BC6;</td>
</tr>
<tr>
<td style="text-align:left">value</td>
<td style="text-align:left">Number</td>
<td style="text-align:left">&#x662F;</td>
<td style="text-align:left">&#x5B9A;&#x4E49;&#x4E8B;&#x4EF6;&#x7684;&#x503C;&#x3002;</td>
</tr>
<tr>
<td style="text-align:left">map</td>
<td style="text-align:left">Object</td>
<td style="text-align:left">&#x5426;</td>
<td style="text-align:left">&#x5B9A;&#x4E49;&#x4E8B;&#x4EF6;&#x7684;&#x5C5E;&#x6027;&#x548C;&#x53D6;&#x503C;&#xFF08;Key-Value&#x952E;&#x503C;&#x5BF9;&#xFF09;</td>
</tr>
</tbody>
</table>
<p>&#x793A;&#x4F8B;</p>
<pre><code class="lang-javascript">uni.stat.recordCalculateEvent({
  category: <span class="hljs-string">&quot;user_pay&quot;</span>,
  key: <span class="hljs-string">&quot;buy_ebook&quot;</span>,
  value: <span class="hljs-number">20</span>
});
</code></pre>

                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="pay.html" class="navigation navigation-prev navigation-unique" aria-label="Previous page: 支付">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"统计","level":"1.5.10","depth":2,"previous":{"title":"支付","level":"1.5.9","depth":2,"path":"api/pay.md","ref":"api/pay.md","articles":[]},"dir":"ltr"},"config":{"gitbook":"*","theme":"default","variables":{},"plugins":[],"pluginsConfig":{"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"}},"file":{"path":"api/stat.md","mtime":"2018-04-04T08:00:14.701Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2018-04-04T08:24:24.953Z"},"basePath":"..","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="../gitbook/gitbook.js"></script>
    <script src="../gitbook/theme.js"></script>
    
        
        <script src="../gitbook/gitbook-plugin-search/search-engine.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search/search.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-sharing/buttons.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    </body>
</html>

